<% comments.forEach(function (comment) { %>
    <div class="comment comment-single">
        <span class="avatar">
            <img src="/img/users_avatar/<%= comment.author.avatar %>">
        </span>
        <div class="content">
            <a class="author" href="/posts/user?author=<%= comment.author._id %>">
                <%= comment.author.name %>
            </a>
            <div class="metadata">
                <span class="date"><%= comment.created_at %></span>
            </div>
            <div class="text">
                <%- comment.content %>
            </div>

            <% if ( user && comment.author._id && user._id.toString() === comment.author._id.toString() ) { %>
                <div class="actions">
                    <a class="reply" href="/posts/<%= post._id %>/comment/<%= comment._id %>/remove">删除</a>
                </div>
            <% } %>
            
            <% if ( user && user.identity.toString()==='admin' ) { %>
                <div class="actions">
                    <a class="reply" href="/posts/<%= post._id %>/comment/<%= comment._id %>/remove">删除</a>
                </div>
            <% } %>
        </div>
    </div>
<% }) %>